import { _decorator, Color, Component, Label, Node, Sprite } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('item')
export class item extends Component {

    @property(Sprite)
    item:Sprite=null
    @property(Label)
    itemtxt:Label=null
    start() {

    }

    update(deltaTime: number) {
        
    }

    iteminit(num:number){
        this.itemtxt.string = num > 0 ? num.toString() : ''
        this.scores(num)
    }
    scores(key:number){
        switch (key) {
            case Math.pow(2,1):
                this.item.color=new Color(123,123,123)
                break;
            case Math.pow(2,2):
                this.item.color=new Color(124,123,123)
                break;
            case Math.pow(2,3):
                this.item.color=new Color(125,123,123)
                break;
            case Math.pow(2,4):
                this.item.color=new Color(126,123,123)
                break;
            case Math.pow(2,5):
                this.item.color=new Color(127,123,123)
                break;
            case Math.pow(2,6):
                this.item.color=new Color(128,123,123)
                break;
            case Math.pow(2,7):
                this.item.color=new Color(129,123,123)
                break;
            case Math.pow(2,8):
                this.item.color=new Color(130,123,123)
                break;
            case Math.pow(2,9):
                this.item.color=new Color(131,123,123)
                break;
            case Math.pow(2,10):
                this.item.color=new Color(132,123,123)
                break;
            case Math.pow(2,11):
                this.item.color=new Color(133,123,123)
                break;
            case Math.pow(2,12):
                this.item.color=new Color(134,123,123)
                break;

            default:
                break;
        }
    }
}


